using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.Events;
public class TipPanel_Main : MonoBehaviour 
{ 
    [SerializeField]
    private Text text_content;
    [SerializeField]
    private Text text_title;
    [SerializeField]
    private Text text_btn_confirm;
    [SerializeField]
    private Text text_btn_close;
    [SerializeField]
    private Button button_close;
    [SerializeField]
    private Button button_confirm;

    void Awake()
    {
        Hide();
    }

    public void ShowTips(string title, string content,UnityAction onConfirmClick, UnityAction onCloseClick = null, 
    bool isShowCloseBtn = true,string confirm_text = "确定", string close_text = "取消")//可选参数要出现在必需参数的后面
    {
        gameObject.SetActive(true);
        text_title.text = title;
        text_content.text = content;
        text_btn_confirm.text = confirm_text;
        text_btn_close.text = close_text;
        button_confirm.onClick.RemoveAllListeners();
        button_confirm.onClick.AddListener(onConfirmClick);
        button_close.onClick.RemoveAllListeners();
        button_close.onClick.AddListener(onCloseClick);

        button_close.gameObject.SetActive(isShowCloseBtn);
    }

    public void Hide()
    {
        gameObject.SetActive(false);
    }
}
